CDIR =../../../..
INCDIR=$(CDIR)/include
CHARMC=$(CDIR)/bin/charmc $(OPTS)

LIB = libmoduleCkMulticast.a
LIBOBJ = ckdummy.o

HEADERS = $(INCDIR)/CkDummy.decl.h \
          $(INCDIR)/CkDummy.def.h \
          $(INCDIR)/ckdummy.h
LIBDEST =  $(CDIR)/lib/$(LIB)

CIFILES = ckdummy.ci

all: $(LIBDEST) $(HEADERS)

#$(INCDIR)/%: %
#	cp $< $@

#$(HEADERS): CkDummy.decl.h ckdummy.h 
#	/bin/cp CkDummy.decl.h $(CDIR)/include
#	/bin/cp CkDummy.def.h $(CDIR)/include
#	/bin/cp ckdummy.h $(CDIR)/include

$(INCDIR)/CkDummy.decl.h: CkDummy.decl.h
	/bin/cp CkDummy.decl.h $(CDIR)/include
$(INCDIR)/CkDummy.def.h: CkDummy.def.h
	/bin/cp CkDummy.def.h $(CDIR)/include
$(INCDIR)/ckdummy.h: ckdummy.h
	/bin/cp ckdummy.h $(CDIR)/include

$(LIBDEST): $(LIBOBJ)
	$(CHARMC) -o $(LIBDEST) $(LIBOBJ) 

CkDummy.def.h: CkDummy.decl.h

CkDummy.decl.h : ckdummy.ci $(CDIR)/bin/charmxi
	$(CHARMC) -c ckdummy.ci

clean:
	rm -f conv-host *.o *.decl.h *.def.h core  $(LIB)

include Make.depends

DEPENDFILE = Make.depends

depends:  $(CIFILES) CkDummy.def.h
	echo "Creating " $(DEPENDFILE) " ..."; 	\
	if [ -f $(DEPENDFILE) ]; then \
           /bin/cp -f $(DEPENDFILE) $(DEPENDFILE).old; \
        fi; \
	echo '#generated by make depends' > $(DEPENDFILE); \
        for i in $(LIBOBJ) ; do \
	      SRCFILE=`basename $$i .o`.C ; \
              echo "checking dependencies for $$i : $$SRCFILE" ; \
              g++ -MM -Wno-deprecated -I$(CDIR)/tmp $$SRCFILE >> $(DEPENDFILE); \
              echo '	$$(CHARMC) -I$(CDIR)/tmp -o '$$i $$SRCFILE >> $(DEPENDFILE) ; \
        done; 

